//
//  JokesCellImage.m
//  Quick_News
//
//  Created by silently on 15-1-30.
//  Copyright (c) 2015年 zkj. All rights reserved.
//

#import "JokesCellImage.h"
#import "UIImageView+WebCache.h"
#import "PerformanceViewController.h"

@implementation JokesCellImage



- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.myImageView = [[UIImageView alloc] init];
        
        [self.myImageView.layer setCornerRadius:7];
        [self.myView addSubview:self.myImageView];
        [self.myImageView release];
    }
    return self;
}



- (void)addViews
{
    self.myImageView.frame = self.myView.bounds;
    [self.myImageView sizeToFit];
    self.myImageView.frame = CGRectMake(0, 0, self.myView.frame.size.width, self.myView.frame.size.width / 4 * 3);
    self.myImageView.clipsToBounds = YES;
    
    self.digestLabel.frame = self.myView.bounds;
    [self.digestLabel sizeToFit];
    self.digestLabel.frame = CGRectMake(10, self.myView.frame.size.width / 4 * 3, self.myView.frame.size.width - 20, self.myView.frame.size.height - self.myView.frame.size.width / 4 * 3 - 40);
    self.cellJokes.digest = [self.cellJokes.digest stringByReplacingOccurrencesOfString:@"（动态图可点击进入查看哦~！）." withString:@""];
    self.cellJokes.digest = [self.cellJokes.digest stringByReplacingOccurrencesOfString:@"&quot;" withString:@""];

    
    [self setValues];

}



- (void)setValues
{
    self.digestLabel.text = self.cellJokes.digest;
    self.digestLabel.font = [UIFont systemFontOfSize:16];
    
    self.collectButton.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"collectEmpty.png"]];
    
    self.goodButton.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"goodEmpty.png"]];
    
    self.goodLabel.text = [NSString stringWithFormat:@":%@", self.cellJokes.upTimes];
    
    [self.myImageView setImageWithURL:[NSURL URLWithString:self.cellJokes.img]];
    
}

- (void)dealloc
{
    [_myImageView release];
    [super dealloc];
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
